<html>
<head><meta charset="utf-8"><title>rustc vfs · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html">rustc vfs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="176148821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176148821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176148821">(Sep 19 2019 at 22:42)</a>:</h4>
<p>Would there be any interest in supporting a VFS/overlay fs in rustc directly? One rationale was to execute <code>cargo check</code> but with in-memory text buffers rather than the files on disk itself. This led to reimplementation of own wrappers VFS in RLS and Rust Analyzer; if we support that directly we could drop the extra code on each side and execute rustc directly.</p>
<p>This would simplify one of the approaches mentioned in the rls/rust-analyzer planning meeting today, where we integrate <code>cargo check</code> directly to provide accurate errors in addition to quick IDE features by Rust Analyzer.<br>
It also would technically allow us to decouple RLS completely from rustc if we were to reuse the existing save-analysis architecture.</p>
<p>cc <span class="user-mention" data-user-id="133169">@matklad</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> (did I miss anyone?)<br>
<span class="user-mention" data-user-id="213049">@Jeremy Fitzhardinge</span> <span class="user-mention" data-user-id="127859">@Taylor Cramer</span> would that be also useful in any scenario involving external build integration?</p>



<a name="176148830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176148830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176148830">(Sep 19 2019 at 22:42)</a>:</h4>
<p>Issue at <a href="https://github.com/rust-lang/rust/issues/59976" target="_blank" title="https://github.com/rust-lang/rust/issues/59976">https://github.com/rust-lang/rust/issues/59976</a></p>



<a name="176149216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176149216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176149216">(Sep 19 2019 at 22:48)</a>:</h4>
<p><span class="user-mention" data-user-id="153740">@Igor Matuszewski</span> Could you expand on "While it's possible to provide a FileLoader trait implementation when running rustc, it requires the user to run the compiler in-process."?</p>



<a name="176149221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176149221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176149221">(Sep 19 2019 at 22:48)</a>:</h4>
<p>Why does it need to be run in-process?</p>



<a name="176149281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176149281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176149281">(Sep 19 2019 at 22:49)</a>:</h4>
<p>I guess " This particular case could be side-stepped by implementing IPC for our VFS implementation that could be relayed to using our FileLoader trait and rustc shim (rls-rustc)." is the alternative to that? Though I'd imagine shared memory would work as well since presumably there's already some notion of locks</p>



<a name="176149341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176149341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176149341">(Sep 19 2019 at 22:50)</a>:</h4>
<p>I personally feel though that this is pretty strongly out of scope for a rustc feature and it's not entirely clear to me why it can't be implemented outside and loaded in as a FileLoader impl -- maybe we can redesign FileLoader to make that more possible?</p>



<a name="176150747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150747">(Sep 19 2019 at 23:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> by in-process I meant that the trait is inherently on the rustc side and if someone wishes to use it then they have to opt into <code>rustc_private</code> anyway and wrap that around</p>



<a name="176150799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150799">(Sep 19 2019 at 23:18)</a>:</h4>
<p>shared memory or IPC works good but requires authoring a separate wrapper</p>



<a name="176150810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150810">(Sep 19 2019 at 23:18)</a>:</h4>
<p>hm, yes, but presumably that's not a problem for RLS etc?</p>



<a name="176150822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150822">(Sep 19 2019 at 23:18)</a>:</h4>
<p>I was wondering if it'd be possible to support something like a pathfile supplied to rustc which it'd use and fallback to the real disk file if not found in the patch</p>



<a name="176150859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150859">(Sep 19 2019 at 23:19)</a>:</h4>
<p>well no, it's not a problem per-se for RLS, we use the shim ourselves as of now</p>



<a name="176150870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150870">(Sep 19 2019 at 23:19)</a>:</h4>
<p>but I imagine Rust Analyzer can't use it since they want to support stable toolchain entirely</p>



<a name="176150933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150933">(Sep 19 2019 at 23:20)</a>:</h4>
<p>so the status quo remains that Rust Analyzer can only provide correct diagnostics if the files are saved</p>



<a name="176150940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150940">(Sep 19 2019 at 23:20)</a>:</h4>
<p>I would be not entirely opposed to the idea of trying to factor out the FileLoader trait into a crate that compiles on stable</p>



<a name="176150956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150956">(Sep 19 2019 at 23:20)</a>:</h4>
<p>and also RLS needs to ship its own version of the compiler, whereas I imagine it'd be good to imagine a way to just point it at the Rust toolchain (with minimum version of XYZ) and expect things to work</p>



<a name="176150961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150961">(Sep 19 2019 at 23:20)</a>:</h4>
<p>(obviously, we might need to issue breaking changes and coordinate updates, etc. -- but that all seems viable)</p>



<a name="176150992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150992">(Sep 19 2019 at 23:21)</a>:</h4>
<p>but given how platform-specific I imagine an virtual file system is, I'd rather not manage it ourselves</p>



<a name="176150997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176150997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176150997">(Sep 19 2019 at 23:21)</a>:</h4>
<p>unless I'm wrong about it being platform specific?</p>



<a name="176151010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151010">(Sep 19 2019 at 23:21)</a>:</h4>
<p>the only bits I imagine can be quite hard are canonical version of the paths</p>



<a name="176151099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151099">(Sep 19 2019 at 23:23)</a>:</h4>
<p>FileLoader already has <code>abs_path</code> - it could be a function to transform all the paths given in a pathfile and always resolve files around these</p>



<a name="176151123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151123">(Sep 19 2019 at 23:23)</a>:</h4>
<p>other than that, we need to be able to load a <code>String</code> under a given path in rustc and not much else, thankfully</p>



<a name="176151388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151388">(Sep 19 2019 at 23:28)</a>:</h4>
<p>hm, so then this might be easier than I expected</p>



<a name="176151403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151403">(Sep 19 2019 at 23:29)</a>:</h4>
<p>if this is just "I want to make rustc load paths with root X instead of <code>/</code>" then that seems viable to implement as an unstable (and maybe on the road to stabilization) flag</p>



<a name="176151408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151408">(Sep 19 2019 at 23:29)</a>:</h4>
<p>Is it that simple, or am I missing something?</p>



<a name="176151877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151877">(Sep 19 2019 at 23:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> it's more of a "hey rustc, when compiling as you do normally, please consider file "src/some/module.rs" to have contents of "XYZ" instead of the actual one on the disk, thanks"</p>



<a name="176151919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151919">(Sep 19 2019 at 23:37)</a>:</h4>
<p>I mean, technically you could do that if for every compilation you create a tempdir, copy everything over  and only patch the relevant bits yourself but that's seems very unpractical somehow</p>



<a name="176151941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151941">(Sep 19 2019 at 23:37)</a>:</h4>
<p>hm, how would you expect to provide the contents?</p>



<a name="176151982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151982">(Sep 19 2019 at 23:38)</a>:</h4>
<p>Passing them as a flag doesn't seem viable :)</p>



<a name="176151986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176151986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176151986">(Sep 19 2019 at 23:38)</a>:</h4>
<p>and might break some relative path "upwards" (some code may depend on the cargo OUT_DIR, so you'd need to analyze the project layout and so on, not pretty)</p>



<a name="176152003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152003">(Sep 19 2019 at 23:38)</a>:</h4>
<p>I guess the simplest would be to pass it a path to a patchfile which would contain only the patched bits?</p>



<a name="176152011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152011">(Sep 19 2019 at 23:38)</a>:</h4>
<p>JSON comes to mind, obviously</p>



<a name="176152051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152051">(Sep 19 2019 at 23:39)</a>:</h4>
<p>and it'd probably be good not to use the actual diffs because then rustc would need to know how to apply them, be careful for the files not to change while it compiles and so on</p>



<a name="176152067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152067">(Sep 19 2019 at 23:40)</a>:</h4>
<p>I guess to me it seems like this is a pretty hard thing to implement in a sort of decoupled way</p>



<a name="176152112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152112">(Sep 19 2019 at 23:40)</a>:</h4>
<p>which makes it a poor candidate for stability in general</p>



<a name="176152126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152126">(Sep 19 2019 at 23:40)</a>:</h4>
<p>(since it seems like it'd be somewhat prone to wanting to change)</p>



<a name="176152129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152129">(Sep 19 2019 at 23:40)</a>:</h4>
<p>I know, it is =( it sort of just promotes FileLoader to CLI</p>



<a name="176152138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152138">(Sep 19 2019 at 23:40)</a>:</h4>
<p>yeah, that seems.. not great</p>



<a name="176152152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152152">(Sep 19 2019 at 23:40)</a>:</h4>
<p>(which is kind of what we want, not sure about alternatives that don't require to ship/wrap rustc themselves)</p>



<a name="176152164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152164">(Sep 19 2019 at 23:41)</a>:</h4>
<p>hm, so maybe one alternative would be to run some binary on each file load?</p>



<a name="176152170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152170">(Sep 19 2019 at 23:41)</a>:</h4>
<p>basically like the "default" is <code>cat</code></p>



<a name="176152176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152176">(Sep 19 2019 at 23:41)</a>:</h4>
<p>like a 'proc macro' but for loaded files?</p>



<a name="176152185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152185">(Sep 19 2019 at 23:41)</a>:</h4>
<p>well, I was thinking more .. just a binary</p>



<a name="176152189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152189">(Sep 19 2019 at 23:41)</a>:</h4>
<p>like, not a shared object or anything</p>



<a name="176152191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152191">(Sep 19 2019 at 23:41)</a>:</h4>
<p>okay</p>



<a name="176152195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152195">(Sep 19 2019 at 23:41)</a>:</h4>
<p>is that too high overhead?</p>



<a name="176152198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152198">(Sep 19 2019 at 23:41)</a>:</h4>
<p>hm</p>



<a name="176152236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152236">(Sep 19 2019 at 23:42)</a>:</h4>
<p>not sure, haven't measured</p>



<a name="176152242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152242">(Sep 19 2019 at 23:42)</a>:</h4>
<p>you'd have to spawn a process for every read file</p>



<a name="176152248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152248">(Sep 19 2019 at 23:42)</a>:</h4>
<p>sure, yeah -- well, you could imagine some structure where e.g. we ban null bytes or something and can pass more than one</p>



<a name="176152253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152253">(Sep 19 2019 at 23:42)</a>:</h4>
<p>(or just full JSON RPC, but I'd rather not)</p>



<a name="176152255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152255">(Sep 19 2019 at 23:42)</a>:</h4>
<p>that seems extensible</p>



<a name="176152261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152261">(Sep 19 2019 at 23:42)</a>:</h4>
<p>like a file pre-processor</p>



<a name="176152275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152275">(Sep 19 2019 at 23:43)</a>:</h4>
<p>yeah, we could even do something like "rustc will run <code>$cmd --format-version=1 $filepath</code>"</p>



<a name="176152287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152287">(Sep 19 2019 at 23:43)</a>:</h4>
<p>D: just imagined a QT moc-style preprocessing</p>



<a name="176152297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152297">(Sep 19 2019 at 23:43)</a>:</h4>
<p>I don't know anything about that :)</p>



<a name="176152337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152337">(Sep 19 2019 at 23:44)</a>:</h4>
<p>that seems... too? powerful</p>



<a name="176152346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152346">(Sep 19 2019 at 23:44)</a>:</h4>
<p>it's extensible but I'm not sure if someone would abuse it anyhow?</p>



<a name="176152355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152355">(Sep 19 2019 at 23:44)</a>:</h4>
<p>maybe I'm going in a wrong direction, sorry about that</p>



<a name="176152372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152372">(Sep 19 2019 at 23:45)</a>:</h4>
<p>it seems powerful and would solve this use-case, yeah</p>



<a name="176152375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152375">(Sep 19 2019 at 23:45)</a>:</h4>
<p>heh, no worries -- I personally would imagine this to be pretty high overhead though</p>



<a name="176152440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152440">(Sep 19 2019 at 23:46)</a>:</h4>
<p>largely though I don't see any other way for us to accept the file contents</p>



<a name="176152448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152448">(Sep 19 2019 at 23:46)</a>:</h4>
<p>like, if we're to do it on stable we want some pretty straightforward way to do so</p>



<a name="176152462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152462">(Sep 19 2019 at 23:47)</a>:</h4>
<p>on the 'too powerful' note, one could even call a C preprocessor on top of each file</p>



<a name="176152467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152467">(Sep 19 2019 at 23:47)</a>:</h4>
<p>which is interesting</p>



<a name="176152471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152471">(Sep 19 2019 at 23:47)</a>:</h4>
<p>you're not wrong, but that seems like "okay, sure" - you could do the same with a proc macro today</p>



<a name="176152478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152478">(Sep 19 2019 at 23:47)</a>:</h4>
<p>#![foo] atop the crate or module and replace all the tokens</p>



<a name="176152486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152486">(Sep 19 2019 at 23:48)</a>:</h4>
<p>that is true</p>



<a name="176152527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152527">(Sep 19 2019 at 23:48)</a>:</h4>
<p>somewhat more limited because input must tokenize as Rust I believe, but that's pretty flexible</p>



<a name="176152563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152563">(Sep 19 2019 at 23:49)</a>:</h4>
<p>well, that'd be one way to do it <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> I'm wondering what would be the performance overhead of that, though</p>



<a name="176152698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176152698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176152698">(Sep 19 2019 at 23:52)</a>:</h4>
<p>in theory one can do this today, right? Like, y'all already wrap rustc so trialing this wouldn't be too hard</p>



<a name="176153690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176153690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176153690">(Sep 20 2019 at 00:11)</a>:</h4>
<p>Yup</p>



<a name="176153700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176153700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176153700">(Sep 20 2019 at 00:11)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> got any thoughts on that?</p>



<a name="176153752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176153752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176153752">(Sep 20 2019 at 00:12)</a>:</h4>
<p>(mostly to see if this is at all viable, and then if it is, we can probably land it as unstable pretty easily; it might need an RFC to be stabilized though -- not sure if an FCP is enough there. It might be)</p>



<a name="176169416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176169416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176169416">(Sep 20 2019 at 06:53)</a>:</h4>
<p>Hello!</p>
<p>So, I think there are two threads here:</p>
<ul>
<li>we can extract VFS into a library and share it between rustc, rust-analyzer and rls</li>
<li>we should add ability to rustc to read files not from disk</li>
</ul>
<p>I am very skeptical of the first one: looks like <code>FileLoader</code> is exactly what <code>rustc</code> currently needs, and it's only a trait. I don't see a benefit of moving it outside. rust-analyzer and rls need something different, and that hopefully can be shared, irrespective of rustc, but design space there is large. I am not to happy about current VFS implementations neither in rls, nor in rust-analyzer. I have a rough plan for better VFS for rust-analyzer, if it works, the result should be sharable between rls and rust-analyzer.</p>
<p>I would like to see the second one, as it allows us to run <code>cargo check</code> without saving files to disk. The most important question here is stability. As this is intended to help IDEs, it's important that it works on stable, but it also should be an internal interface that no one should use. Can we have <code>#[doc(hidden)]</code> flags for rustc? I think we can: for one, <code>RUST_BOOTSTRAP</code> is one, and it is a much greater stabilization hazard than the proposed. If there's a constraint that we want to design this feature such that it is stable for realz, I think that maybe it's not worth it: the IDE can just save files before calling <code>cargo check</code> or the like. IntelliJ <a href="https://github.com/intellij-rust/intellij-rust/blob/93904a39c0f28fc9b250b2fda0700c62e3297e0c/src/main/kotlin/org/rust/ide/annotator/RsExternalLinterUtils.kt#L99" target="_blank" title="https://github.com/intellij-rust/intellij-rust/blob/93904a39c0f28fc9b250b2fda0700c62e3297e0c/src/main/kotlin/org/rust/ide/annotator/RsExternalLinterUtils.kt#L99">does this</a>.</p>
<p>I am not sure what is the right interface for IPC-ish vfs inside rustc. I don't like idea of passing a map of modified files as a json flag, as it might be hard to figure out which of modified files are relevant to rustc (that is, how IDE should figured out that there's no need to pass <code>.cpp</code> files)? I don't like the idea of shelling out to new external process to read every file, as it suffers from the opposite problem: most files are just fine as they are on disk, so this creates needless overhead. </p>
<p>I'd love a pipe-based IPC: basically, we pass <code>VFS_FILE_DESCRIPTOR=92</code> env var, and then we shuffle something stupid like bincode or newline separate JSON over it. Not sure how cross-platform pipes are. Not sure how this should work with concurrent rustc invocations.</p>



<a name="176169776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176169776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176169776">(Sep 20 2019 at 07:02)</a>:</h4>
<p>Apparently, IntelliJ would also be interested in this, so cc <span class="user-mention" data-user-id="200750">@Vlad</span>  :-) This makes my ideas of "stable, do not use this" interface more questionable, but I still think that it would be good to phrase this as: this API is doc-hidden, only selected set of tools (rust-analyzer, RLS, IntelliJ) are allowed to use it, API can break between releases of the compiler.</p>



<a name="176170446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176170446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176170446">(Sep 20 2019 at 07:18)</a>:</h4>
<p>for the record I meant to tackle the second of the point you listed here =)</p>



<a name="176182208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176182208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176182208">(Sep 20 2019 at 10:52)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> I would personally object pretty strongly to what I think you're suggesting - stabilizing something "just for IDEs" doesn't seem viable to me, even if it is done via a env variable or so. I would definitely want that to go through RFC process to elaborate why we think it's okay to break the IDE use case but not others (if I'm understanding you correctly that we'd allow use in stable, but still reserve the right to break it)</p>



<a name="176182422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176182422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176182422">(Sep 20 2019 at 10:56)</a>:</h4>
<p>Agree that it should go via RFC process, as its a departure from stability guarantees. The short reason why I think is ok is that IDEs have to track unstable features and compiler versions anyway (as std uses unstable), and that I don't see any other important consumers of this feature.</p>



<a name="176182567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176182567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176182567">(Sep 20 2019 at 10:58)</a>:</h4>
<p>(to give a concrete example, changing sysroot crate graph definitely breaks IntelliJ, because it manually tracks deps between sysroot crates)</p>



<a name="176659098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659098">(Sep 26 2019 at 13:47)</a>:</h4>
<p>I tend to think it may also be viable to have a function that is avaiable "on stable" but documented as being exempted from the standard stability guarantees (and suitably hidden, etc)</p>



<a name="176659236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659236">(Sep 26 2019 at 13:49)</a>:</h4>
<p>hm, sure, but I think that probably doesn't buy us much? I presume RLS etc want actual stability :)</p>



<a name="176659253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659253">(Sep 26 2019 at 13:49)</a>:</h4>
<p>why?</p>



<a name="176659267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659267">(Sep 26 2019 at 13:49)</a>:</h4>
<p>we issue an RLS version per rustc release, right?</p>



<a name="176659291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659291">(Sep 26 2019 at 13:50)</a>:</h4>
<p>I imagine anyway it would be documented as "this may be changed betwen rust releases, but we make an effort to coordinate with known users" and the expectation would be that it's "mostly stable"</p>



<a name="176659346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659346">(Sep 26 2019 at 13:50)</a>:</h4>
<p>anyway, i'm not sure if that's a good idea, but I think that for tools integration we may want to consider things like that</p>



<a name="176659351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659351">(Sep 26 2019 at 13:50)</a>:</h4>
<p>hm, maybe RLS is not a good example -- since we do build that in tree. But I think <span class="user-mention" data-user-id="133169">@matklad</span> was saying that e.g. rust-analyzer wants to compile on arbitrary stable/nightly etc</p>



<a name="176659376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659376">(Sep 26 2019 at 13:50)</a>:</h4>
<p>yeah, it would mean the rust-analyzer has to be used with a "matched" version of rust</p>



<a name="176659399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659399">(Sep 26 2019 at 13:51)</a>:</h4>
<p>(though it could be <em>built</em> with any, sounds like?)</p>



<a name="176659412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659412">(Sep 26 2019 at 13:51)</a>:</h4>
<p>I thought that was what <span class="user-mention" data-user-id="133169">@matklad</span> was requesting, but maybe I misunderstood</p>



<a name="176659481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176659481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176659481">(Sep 26 2019 at 13:52)</a>:</h4>
<p>I understood as "used" -- unless the function is like extern "C" or something we can't really support the 'build but not used' due to ABI differences, right?</p>



<a name="176660100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176660100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176660100">(Sep 26 2019 at 14:00)</a>:</h4>
<p>true</p>



<a name="176660122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176660122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176660122">(Sep 26 2019 at 14:00)</a>:</h4>
<p>anyway it does seem "icky"</p>



<a name="176660137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176660137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176660137">(Sep 26 2019 at 14:00)</a>:</h4>
<p>butI thought maybe matklad was referring to some IPC-based sol'n?</p>



<a name="176660157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176660157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176660157">(Sep 26 2019 at 14:00)</a>:</h4>
<p>tbh I didn't read all the details :)</p>



<a name="176660163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176660163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176660163">(Sep 26 2019 at 14:00)</a>:</h4>
<p>/me too many messages right now</p>



<a name="176664254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176664254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176664254">(Sep 26 2019 at 14:47)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> rust-analyzer does not link to rustc, by design, so ABI is completely irrelevant. That is, rust-analyzer is just a vanilla binary crate, which builds on the latest stable, and I prefer to keep it so for forseable future. </p>
<p>"what compiler/cargo can you use <em>together</em> with rust-analyzer, for developing your code?" is another question. The current policy  is roughtly "any compiler older that X", where X is some constant that exists, is strictly grater than 1.0.0, but whose precise value is unknown to me. That is, we just assume that certain Cargo flags exists (most notably, <code>cargo metadata</code> which introduce somewhere around 1.10-ish). We definitely do not make a promise to work with arbitrary old rustc</p>



<a name="176664353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176664353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176664353">(Sep 26 2019 at 14:48)</a>:</h4>
<p>I was responding to Niko's proposal of a function (which then means ABI)</p>



<a name="176664487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176664487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176664487">(Sep 26 2019 at 14:49)</a>:</h4>
<p>Ah, yeah, I got confused, that's definitelly IPC we need, and not a function.</p>



<a name="176665266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665266">(Sep 26 2019 at 14:57)</a>:</h4>
<blockquote>
<p>I was responding to Niko's proposal of a function (which then means ABI)</p>
</blockquote>
<p>really I meant IPC anyway :)</p>



<a name="176665286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665286">(Sep 26 2019 at 14:57)</a>:</h4>
<p>what I meant is: we can offer some interface and say "this interface exists, but the data that passes through it is unstable"</p>



<a name="176665289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665289">(Sep 26 2019 at 14:57)</a>:</h4>
<p>we've done that before...</p>



<a name="176665313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665313">(Sep 26 2019 at 14:57)</a>:</h4>
<p>...it seems better if it's IPC than the set of arguments etc on a fn, but it's the same principle isn't it?</p>



<a name="176665314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665314">(Sep 26 2019 at 14:57)</a>:</h4>
<p>Yes, I think that's true. We can definitely do that -- I was uncertain how helpful that'd be to RLA folks though.</p>



<a name="176665636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665636">(Sep 26 2019 at 15:00)</a>:</h4>
<p>(deleted)</p>



<a name="176665691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665691">(Sep 26 2019 at 15:00)</a>:</h4>
<p>(deleted)</p>



<a name="176665726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665726">(Sep 26 2019 at 15:01)</a>:</h4>
<p>(deleted)</p>



<a name="176665942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176665942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176665942">(Sep 26 2019 at 15:03)</a>:</h4>
<p>oops I failed basic reading comprehension upthread</p>



<a name="176666148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176666148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176666148">(Sep 26 2019 at 15:05)</a>:</h4>
<p>I think it would be helpful yeah, for both rust-analyzer and maybe IntelliJ Rust, exactly because they explicitly track "several recent stables".</p>



<a name="176666220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176666220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176666220">(Sep 26 2019 at 15:06)</a>:</h4>
<p>Specifically, this is the range of rusts that is guaranteed to work with IntelliJ: <a href="https://github.com/intellij-rust/intellij-rust/blob/06c94f051859492ceacc1e4b32a8125da112fddb/.travis.yml#L13-L15" target="_blank" title="https://github.com/intellij-rust/intellij-rust/blob/06c94f051859492ceacc1e4b32a8125da112fddb/.travis.yml#L13-L15">https://github.com/intellij-rust/intellij-rust/blob/06c94f051859492ceacc1e4b32a8125da112fddb/.travis.yml#L13-L15</a></p>



<a name="176666324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176666324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176666324">(Sep 26 2019 at 15:07)</a>:</h4>
<p>(and ide authors are ok with implementing version checks on their side, so breaking iface abruptly between two versions is also ok)</p>



<a name="176667478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/176667478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#176667478">(Sep 26 2019 at 15:20)</a>:</h4>
<blockquote>
<p>I don't like idea of passing a map of modified files as a json flag, as it might be hard to figure out which of modified files are relevant to rustc (that is, how IDE should figured out that there's no need to pass .cpp files)? </p>
</blockquote>
<p>Actually, a nice middle ground here could be to pass a list of potentially modified path <em>prefixes</em>. Passing <code>/</code> would cause <code>rustc</code> to query every for file, passing <code>/path/to/my-project</code> would cause it to ask for files in your project, but not in the <a href="http://crates.io" target="_blank" title="http://crates.io">crates.io</a>. That gets rid of a nasty edge case where you have a huge number of modified files, but rustc is going to read only a dozen of them, as you probably can compress that huge number to one common prefix</p>



<a name="177058314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177058314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177058314">(Oct 01 2019 at 14:08)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> I'm not sure I understand - I proposed the (made up) <code>--modified-files JSON</code> as an alternative to IPC-based solution</p>



<a name="177058547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177058547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177058547">(Oct 01 2019 at 14:10)</a>:</h4>
<p>In general, the modified fileset will only be as big as the set of files you have currently modified-but-not-saved in the editor.</p>
<p>I don't expect it to be too big to make a difference; the only scenario I can see that is when a user treats VS Code (or any IDE) like an OS and has opened multiple workspaces at once and thus potentially also has multiple big, modified files.</p>
<p>Even then, I guess we could kind of only store patches, which I believe would solve the file size case but might introduce more cost/complexity at the IDE/rustc side to calculate/apply the patches</p>



<a name="177065203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177065203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177065203">(Oct 01 2019 at 15:17)</a>:</h4>
<p><span class="user-mention" data-user-id="153740">@Igor Matuszewski</span> i am slightly suspicious of the assumption that "the set of modified files is small". I believe that it's true in at least 99% of cases, but it would be cool if the solution didn't fundamentally depend on this.  For something like IntelliJ, the set of <em>dirty</em> files might be pretty large I think.  But I am ready to admit that this might be over-engineering :) </p>
<p>To solve this "perfectly", I think we need to things:</p>
<ul>
<li>compiler should pull the relevant files from the client (so that the client doens't have to construct the whole set of modifed files upfront)</li>
<li>but it should also avoid pulling most of the files, if they are known to be fresh on disk. </li>
</ul>
<p>Hence my idea about communicating the set of paths to the compiler which it <em>might</em> need to pull from the client.</p>



<a name="177089204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177089204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177089204">(Oct 01 2019 at 19:27)</a>:</h4>
<p>Oh, so it's an optimization of the IPC case rather than of the "overlayfs" approach, I see</p>



<a name="177089282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177089282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177089282">(Oct 01 2019 at 19:28)</a>:</h4>
<p>it definitely makes  sense in that case</p>



<a name="177089308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177089308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177089308">(Oct 01 2019 at 19:28)</a>:</h4>
<p>in that specific case you might as well send a list of the modified files a priori rather than a specific prefix</p>



<a name="177089498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177089498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177089498">(Oct 01 2019 at 19:30)</a>:</h4>
<p>since sending prefix only isn't as fine-grained and if someone's concerned with the combined length of the modified files' paths then it's possible you should be concerned with different problems... <span aria-label="stuck out tongue wink" class="emoji emoji-1f61c" role="img" title="stuck out tongue wink">:stuck_out_tongue_wink:</span></p>



<a name="177089578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177089578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177089578">(Oct 01 2019 at 19:31)</a>:</h4>
<p>however that still requires agreeing to a stable-ish IPC mechanism which still requires some plumbing on the client/server side</p>



<a name="177090703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177090703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177090703">(Oct 01 2019 at 19:45)</a>:</h4>
<p>okay this is steering into a bit of a madman territory but what if we combine both of the approaches and allow a bit of flexibility:<br>
We could allow (in TS):</p>
<div class="codehilite"><pre><span></span><span class="nx">type</span> <span class="nx">Fileset</span> <span class="o">=</span> <span class="nb">Array</span><span class="o">&lt;</span><span class="p">{</span> <span class="nx">file</span>: <span class="kt">string</span><span class="p">;</span> <span class="nx">contents</span>: <span class="kt">Contents</span> <span class="p">}</span><span class="o">&gt;</span><span class="p">;</span>
<span class="nx">type</span> <span class="nx">Contents</span> <span class="o">=</span> <span class="p">{</span> <span class="nx">kind</span><span class="o">:</span> <span class="s1">&#39;text&#39;</span><span class="p">;</span> <span class="nx">value</span>: <span class="kt">string</span><span class="p">;</span> <span class="p">}</span> <span class="o">|</span> <span class="p">{</span> <span class="nx">kind</span><span class="o">:</span> <span class="s1">&#39;command&#39;</span><span class="p">;</span> <span class="nx">value</span>: <span class="kt">Command</span><span class="p">;</span> <span class="p">}</span> <span class="o">|</span> <span class="p">{</span> <span class="nx">kind</span><span class="o">:</span> <span class="s1">&#39;diff&#39;</span><span class="p">;</span> <span class="nx">value</span>: <span class="kt">string</span><span class="p">;</span> <span class="p">};</span>
<span class="nx">type</span> <span class="nx">Command</span> <span class="o">=</span> <span class="kt">string</span><span class="p">;</span> <span class="c1">// or something that denotes a spawnable command</span>
</pre></div>



<a name="177090763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177090763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177090763">(Oct 01 2019 at 19:46)</a>:</h4>
<p>(let's say that <code>diff</code> is experimental and should be left out initially)</p>



<a name="177090841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177090841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177090841">(Oct 01 2019 at 19:47)</a>:</h4>
<p>this could support passing entire file patches or if IPC approach is desired, the LS can prepare such  fileset that it leaves all of the IPC/plumbing details to that client</p>



<a name="177090866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177090866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177090866">(Oct 01 2019 at 19:47)</a>:</h4>
<p>one implementation might be to spawn and connect to an previously prepared IPC server to serve only that file</p>



<a name="177090925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177090925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177090925">(Oct 01 2019 at 19:48)</a>:</h4>
<p>with this the cost of implementation is relatively low on the <code>rustc</code> side - either read patched files or just spawn a command</p>



<a name="177090954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177090954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177090954">(Oct 01 2019 at 19:48)</a>:</h4>
<p>and if the LS wants to do anything fancy with IPC then sure</p>



<a name="177091000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177091000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177091000">(Oct 01 2019 at 19:49)</a>:</h4>
<p>one could imagine having an IPC-enabled VFS with immutable data structure with snapshots identifiable by IDs where you could invoke something like <code>vfs-client &lt;snapshot-id&gt; &lt;file-path&gt;</code></p>



<a name="177091111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177091111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177091111">(Oct 01 2019 at 19:50)</a>:</h4>
<p>or the server could spawn an IPC VFS instance for a specific snapshot and you would know that you need to do something like <code>vfs-client --fd=92 &lt;file-path&gt;</code>or anything similar</p>



<a name="177091168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177091168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177091168">(Oct 01 2019 at 19:51)</a>:</h4>
<p>the only thing this would suck is when basically everything is dirty and you need to invoke a command for each of the files listed to get the contents, but that was our starting point and as you're saying we shouldn't really assume every file is dirty (and rather tell rustc upfront)</p>



<a name="177091180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177091180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177091180">(Oct 01 2019 at 19:51)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> what do you think?</p>



<a name="177091524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177091524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177091524">(Oct 01 2019 at 19:56)</a>:</h4>
<p>I think that, even long-term, diff is probably not a good idea. As far as I understand, there's no really a way to make two processes, to agree on the contents of file on disk, so diff solutions will inevitable be prone to "someone modifed the file in the meantime, so the diff doesn't make sence" problem.</p>



<a name="177091637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177091637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177091637">(Oct 01 2019 at 19:57)</a>:</h4>
<p>At the same time, I don't think that sending the whole file over the wire is a problem: compiler does O(N) processing on it anyway.</p>



<a name="177091730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177091730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177091730">(Oct 01 2019 at 19:58)</a>:</h4>
<p>Not sure about "external command / file-in-place" flexibility. I suspect that we might just start with only <code>kind: 'text'</code> and then figure out that its enough</p>



<a name="177093716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177093716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177093716">(Oct 01 2019 at 20:17)</a>:</h4>
<p>well that is true, it's in fact more deterministic to send the file in a ready state or a command that's supposed to guarantee that as well</p>



<a name="177107946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177107946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177107946">(Oct 01 2019 at 23:29)</a>:</h4>
<p>Well, do you think it's PR-worthy?</p>



<a name="177108020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177108020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177108020">(Oct 01 2019 at 23:30)</a>:</h4>
<p>we might as well start with something  <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="177108037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177108037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177108037">(Oct 01 2019 at 23:30)</a>:</h4>
<p>I assume RA and intelliJ would be more interested in the VFS implementation itself rather than the "overlayfs"?</p>



<a name="177108046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustc%20vfs/near/177108046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustc.20vfs.html#177108046">(Oct 01 2019 at 23:30)</a>:</h4>
<p>(in terms of unifying IDE work)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>